package 笔试2.wangyi.one;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        String s="7300";
        Scanner sc = new Scanner(System.in);
        s=sc.nextLine();
        char[] c = s.toCharArray();
        int res=0;
        Long x= Long.parseLong(s);
        for (int i = 0; i < c.length; i++) {
            if(c[i]=='0'){
                continue;
            }
            else if(x%Long.parseLong(c[i]+"")==0){
                res++;
            }
        }
        System.out.println(res);
    }
}
